Skip to content

fix: preserve omitted color-mix weights in serialized native styles - #511

Closed
NateIsern wants to merge 2 commits into
nativewind:mainfrom
NateIsern:fix/serialized-color-mix-weights
Closed

NateIsern wants to merge 2 commits into
nativewind:mainfrom
NateIsern:fix/serialized-color-mix-weights

Conversation

@NateIsern

Copy link
Copy Markdown
Contributor

Native Metro injection serializes compiled stylesheets with JSON.stringify. Omitted color-mix percentage slots become null in arrays; the runtime leaves that placeholder unconsumed and rejects the valid expression. For example Tailwind text-white/50 resolves to no color on Android although registerCSS-based tests pass (they inject the unserialized object).

Consume the null placeholder for an omitted percentage while retaining the existing complementary-weight rules. The regression compiles actual CSS with inlineVariables disabled, round-trips the stylesheet through JSON like native injection, and renders through the native runtime. It covers omitted left, right and both weights.

Validation: 3 new cases fail before the fix; all 14 color-mix tests pass afterward. Reproduced in a physical Android release app on react-native-css 3.1.0-rc.0.

danstepanov pushed a commit that referenced this pull request Nov 20, 2026
…ors (#579)

Supersedes #464 and #511.

Co-authored-by: Ethan <ethan@zolplay.com>
Co-authored-by: Nate I. <nate@oxy.so>
@danstepanov

Copy link
Copy Markdown
Member

Closing this in favor of #579, which carries your commit along with the other color-mix fix and some changes from Sam. It just landed in 2438829.

Thanks for this one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants